package ai.yiye.leveldbdemo;

import org.rocksdb.Options;
import org.rocksdb.RocksDB;
import org.rocksdb.RocksDBException;

public class Main1 {
    public static void main(String[] args) throws Exception {
        RocksDB.loadLibrary();

        try (final Options options = new Options().setCreateIfMissing(true)) {

            // a factory method that returns a RocksDB instance
            try (final RocksDB db = RocksDB.open(options, "/home/wukong/rocksexample")) {
                db.put("hello".getBytes(), "world".getBytes());
                System.out.println(new String(db.get("hello".getBytes())));
            }
        } catch (RocksDBException e) {
            // do some error handling
            e.printStackTrace();
        }
    }
}
